
<div id="content">
    <h2><?=$this->pageTitle?></h2>
    <?=$GLOBALS["lang"]->_("title")?>: <br/>
    <input type="text" name="pageTitle" id="pageTitle" value="<?=$this->page["title"]?>" /><br/><br/>
    <?=$GLOBALS["lang"]->_("content")?>: <br/>
    <textarea id="pageContent" name="pageContent"><?=$this->page["content"]?></textarea>    
</div>

<div id="rightMenu">
    <div id="responseDiv"></div>
    <div class="button" onclick="save();">
        <div class="saveImg"></div>
        <div class="buttonText"><?=$GLOBALS["lang"]->_("save")?></div>
    </div>
    <a href="<?=$this->baseUrl()?>/content">
        <div class="button">
            <div class="listImg"></div>
            <div class="buttonText"><?=$GLOBALS["lang"]->_("list-content")?></div>
        </div>
    </a>
</div>

<script type="text/javascript">
	
    CKEDITOR.replace("pageContent", { toolbar : 'MyToolbar' } );
    
    function save() {
        $("responseDiv").innerHTML = "<?=$GLOBALS["lang"]->_("saving")?>";
        var pageContentValue = CKEDITOR.instances.pageContent.getData();
        var myAjax = new Ajax.Request('<?=$this->baseUrl()?>/content/save',
                     { method: 'get', 
                       parameters: { id: '<?=$this->page["id"]?>',
                                     title: pageTitle.value, 
                                     content: pageContentValue },
                       onComplete: response
                     });
    }
    
    var response = function(transport) {
        $("responseDiv").innerHTML = transport.responseText;
        $("responseDiv").pulsate();
    }
</script>
